from typing import List, Dict, Any
from dataclasses import dataclass
import logging

# 配置日志
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

@dataclass
class Document:
    """文档数据结构"""
    id: str
    content: str
    metadata: Dict[str, Any] = None

    def __post_init__(self):
        if self.metadata is None:
            self.metadata = {}


@dataclass
class RetrievalResult:
    """检索结果数据结构"""
    document: Document
    score: float
    hop_level: int


class QueryPlan:
    """查询计划"""

    def __init__(self, original_query: str):
        self.original_query = original_query
        self.sub_queries: List[str] = []
        self.retrieved_docs: List[RetrievalResult] = []
        self.current_hop = 0